package com.ball.dev.service.impl;

import com.ball.common.dtos.ResponseResult;
import com.ball.common.enums.AppHttpCodeEnum;
import com.ball.dev.entity.po.Options;
import com.ball.dev.entity.po.Options;
import com.ball.dev.mapper.OptionMapper;
import com.ball.dev.service.IOptionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 * 选项表 服务实现类
 * </p>
 *
 * @author lou
 * @since 2024-04-15
 */
@Service
public class OptionServiceImpl extends ServiceImpl<OptionMapper, Options> implements IOptionService {

   @Override
    public ResponseResult addOption(Options option) {

        //设置创建时间
        option.setCreateTime(LocalDateTime.now());

        //保存选项
        return save(option) ? ResponseResult.okResult("添加成功") :
                ResponseResult.errorResult(AppHttpCodeEnum.PARAM_REQUIRE);
    }
}
